#!/bin/bash
killall conky &
killall cfw &
killall dwmblocks &
killall xidlehook &

feh --bg-scale --no-fehbg $HOME/.dwm/background.jpg &
/usr/bin/emacs --daemon &
fcitx5 &
nm-applet &
picom -b &
sleep 1 && dwmblocks &
sleep 1 && conky -c ~/.config/conky/conky.conf 
sleep 1 && cfw --help &
sleep 1 && xidlehook \
  `# Don't lock when there's a fullscreen application` \
  --not-when-fullscreen \
  `# Don't lock when there's audio playing` \
  --not-when-audio \
  `# Dim the screen after 60 seconds, undim if user becomes active` \
  --timer 60 \
    'xrandr --output eDP-1 --brightness .1' \
    'xrandr --output eDP-1 --brightness 1' \
  `# Undim & lock after 10 more seconds` \
  --timer 60 \
    'xrandr --output eDP-1 --brightness 1; betterlockscreen -l' \
    '' \
  `# Finally, suspend an hour after it locks` \
  --timer 600 \
    'systemctl suspend' \
    ''
